﻿using System.ComponentModel;
using MauiTurntable.ViewModel;
using Microsoft.Maui.Controls;

namespace MauiTurntable
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
            this.Loaded += MainPage_Loaded;
        }

        private void MainPage_Loaded(object? sender, EventArgs e)
        {
            Button_Clicked(null,null);
        }

        /// <summary>
        /// 大转盘
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Button_Clicked(object sender, EventArgs e)
        {
            container.Clear();
            var cv = new cvTurnTable();
            container.Add(cv, 0, 0);

        }
        /// <summary>
        /// 信息编辑
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Clicked_1(object sender, EventArgs e)
        {
            container.Clear();
            var cv = new cvInfoEdit();
            var mode = cv.BindingContext as cvInfoEditModel;
            mode.Alarm += Mode_Alarm;
            container.Add(cv, 0, 0);
        }
        private async void Mode_Alarm(string obj)
        {
            await DisplayAlert("Alert", obj, "OK");

            // this.popupService.ShowPopup<NamePopupViewModel>(Application.Current.Windows[0].Page);
        }
    }

}
